<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="email=no" name="format-detection"/>
    <meta content="telephone=no" name="format-detection" />
    <link href="/Public/css/layout.css" type="text/css" rel="stylesheet" >
    <link href="/Public/css/coverflow.css" type="text/css" rel="stylesheet" >
    <script src="/Public/js/jquery-1.10.1.min.js"></script>
</head>
<body>
<img src="/Public/images/loginbanner.png" width="100%" height="auto" class="login-banner" style=" display:none;">
<div class="page-e9">
    <div class="login"><a href="javascript:history.back();"> <i class="icon-iconfont-fanhui1"></i></a>
        <span class="login-tx"><img src="/Public/images/avatar-large.png"></span>
    </div>
    <div class="login-sub" style="margin-top:30px;">
        <div class="login-sub-c"><i class="icon-iconfont-quxiao"></i><i class="icon-iconfont-shouji"></i>
            <div class="login-inp">
                <input type="text" name="mobile" id="mobile">
            </div>
        </div>
    </div>
    <div class="login-sub">
        <div class="login-sub-c">
            <div class="wrap">
                <input type="checkbox" id="s4" checked="" />
                <label class="slider-v2" onclick="changePassword();" for="s4"><span class="txt">abc</span></label>
            </div>
            <i class="icon-iconfont-suo"></i>
            <div class="login-inp">
                <input type="text" name="password" id="password">
            </div>
        </div>
    </div>
    <div class="login-sub">
        <div class="login-btn-c"><a href="/sign"><span class="login-fr">注册</span></a>
            <a href="/forget_password"> <span class="login-fl">忘记密码</span></a></div>
    </div>
    <div class="login-sub">
        <div class="login-btn-c">
            <button class="login-btn" type="button" onclick="do_login();">登录</button>
        </div>
    </div>
    <div class="login-sub">
        <div class="login-btn-c">
            <div class="load-more"><span style="background:#e9eff1;" id="thread_login">使用第三方账号登录</span>
                </div>
        </div>
        <div class="login-sub">
            <div id="oauth_login_div" class="login-btn-c login-btn-c1">
                <span class="login-zh"><i class="icon-iconfont-qq"></i></span>
                <span class="login-zh"><i class="icon-iconfont-weixin"></i></span>
                <span class="login-zh"><i class="icon-iconfont-xinlangweib"></i></span>
            </div>
        </div>
    </div>
    <div class="status_alert" style="display: none" id="status_alert">手机号码不正确</div>
</div>
<script>
    $(window).load(function(){
        var imgH=$(".login-banner").height();
        $(".login").css("height",imgH);
    });

    $('#oauth_login_div i').click(function(){
        var status_alert = $("#status_alert");
        status_alert.text('网站不支持第三方登录，请下载APP');
        status_alert.fadeIn();
        setTimeout(function(){status_alert.fadeOut()},2000);
    });

    function changePassword(){
        if($('#password').attr('type') == 'text'){
            $('#password').attr('type','password');
        }else{
            $('#password').attr('type','text');
        }
    }

    function do_login(){
        var mobile = $("#mobile").val();
        var password = $("#password").val();
        var access = 'xhr';
        var status_alert = $("#status_alert");
        if(mobile.length == 0 || password.length == 0 ){
            status_alert.text('用户名或密码不能为空');
            status_alert.fadeIn();
            setTimeout(function(){status_alert.fadeOut()},2000);
            return;
        }
        $.ajax({
            url:'/do_login',
            type:'post',
            data:{
                mobile:mobile,
                password:password,
                access:access
            },
            dataType:'json',
            beforeSend:function(){
                status_alert.text('正在登录请稍等...');
                status_alert.fadeIn();
                setTimeout(function(){status_alert.fadeOut()},2000);
            },
            success:function(msg){
                if(msg.code == 200) {
                    status_alert.text('登录成功，正在跳转...');
                    status_alert.fadeIn();
                    setTimeout(function(){status_alert.fadeOut()},2000);
                    window.location.href = document.referrer;
                }else{
                    status_alert.text(msg.message);
                    status_alert.fadeIn();
                    setTimeout(function(){status_alert.fadeOut()},2000);
                }
            }
        })
    }
</script>
</body>
</html>